package cn.zd.erp.auth.emp.dao.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import cn.zd.erp.auth.emp.dao.dao.EmpDao;
import cn.zd.erp.auth.emp.vo.EmpModel;

@Repository
public class Emplmpl extends HibernateDaoSupport implements EmpDao {
	@Autowired
	public void setMySessionFactory(SessionFactory sessionFactory){  
	    super.setSessionFactory(sessionFactory);  
	}  
	
	public Emplmpl getByLoginName(String name) {
		return null;
	}

	public EmpModel getByUserNameAndPwd(String userName, String pwd) {
		String hql = "from EmpModel where loginname = ? and password = ?";
		List<EmpModel>  lemp= this.getHibernateTemplate().find(hql,userName,pwd);
		return lemp.size()>0?lemp.get(0):null;
	}

}
